package cn.hy.preparelesson.common.enums;

public enum FileUploadType {
    //
    APP_AVATAR((byte) 0, "/app_avatar", "应用图像"),
    USER_AVATAR((byte) 1, "/user_avatar", "用户图像"),
    STUDENT_PHOTO((byte) 2, "/student_photo", "学生照片"),
    MENU_ICON((byte) 3, "/menu_icon", "菜单图标"),
    STUDENT_EC_PHOTO((byte) 4, "/student_ec_photo", "学生紧急联系人照片"),
    STAFF_PHOTO((byte) 5, "/staff_photo", "教职工照片"),
    PREPARE_LESSON_FILE((byte) 6, "/prepare_lesson_file", "备课附件"),
    RICH_TEXT_PHOTO((byte) 7, "/rich_test_photo", "富文本中的图片"),
    ;

    private byte code;
    /**
     * 分类路径
     */
    private String typePath;
    private String msg;

    FileUploadType(byte code, String typePath, String msg) {
        this.code = code;
        this.typePath = typePath;
        this.msg = msg;
    }

    /**
     * 根据code获取
     * @param code
     * @return
     */
    public static FileUploadType getByCode(Byte code) {
        if (code == null) {
            return null;
        }
        FileUploadType[] values = FileUploadType.values();
        for (FileUploadType value : values) {
            if (value.code == code) {
                return value;
            }
        }
        return null;
    }

    public String getTypePath() {
        return typePath;
    }

    public void setTypePath(String typePath) {
        this.typePath = typePath;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public byte getCode() {
        return code;
    }

    public void setCode(byte code) {
        this.code = code;
    }
}
